﻿@model Orchard.ContentFields.ViewModels.EditNumericFieldViewModel
@using System.Globalization
@using Orchard.ContentManagement.Metadata.Models
@using Orchard.ContentFields.Settings;
@{
    var settings = Model.PartFieldDefinition.Settings.ToObject<NumericFieldSettings>();
    string name = Model.PartFieldDefinition.DisplayName();
    string step = Math.Pow(10, 0 - settings.Scale).ToString(CultureInfo.InvariantCulture);
    decimal min = settings.Minimum.HasValue ? settings.Minimum.Value : 0;
    decimal max = settings.Maximum.HasValue ? settings.Maximum.Value : 10000;
    string id = Html.IdFor(m => m.Value);
}

<fieldset class="form-group">
    <div class="row col-sm">
        <label asp-for="Value">@name</label>
        <input asp-for="Value" typeof="text" class="content-preview-select" type="number" required="@settings.Required" />
        <span class="hint">@settings.Hint</span>
    </div>
</fieldset>
<script at="Foot">
    $(function () {
        $('#@(id)').spinner({
            min: @min,
            max: @max,
            step: @step
        });
    });
</script>